Skip to content

Commit 09bbf50

Browse files
Change order creation examples (#9)
1 parent 9e287c1 commit 09bbf50

File tree

1 file changed

+46
-49
lines changed

1 file changed

+46
-49
lines changed

examples/step1_checkout_create.php

Lines changed: 46 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ function createCheckoutPayload() {
5151
* Article model
5252
*/
5353
$article = new stdClass();
54-
$article->id = '89793238462643383279'; // The article ID.
55-
$article->name = 'Reloj en oro blanco de 18 quilates y diamantes'; // Article name.
56-
$article->url = 'http://shop.example.com/product.html'; // Article url.
57-
$article->image_url = 'http://shop.example.com/product_image.png'; // Article image url.
58-
$article->quantity = 2; // Article quantity.
54+
$article->id = '89793238462643383279'; // The article ID.
55+
$article->name = 'Reloj en oro blanco de 18 quilates y diamantes'; // Article name.
56+
$article->url = 'http://shop.example.com/product.html'; // Article url.
57+
$article->image_url = 'http://shop.example.com/product_image.png'; // Article image url.
58+
$article->quantity = 2; // Article quantity.
5959
$article->price = Aplazame\Serializer\Decimal::fromFloat(4020.00); // Article price (tax is not included). (4,020.00 €)
60-
$article->description = 'Movimiento de cuarzo de alta precisión'; // Article description.
60+
$article->description = 'Movimiento de cuarzo de alta precisión'; // Article description.
6161
$article->tax_rate = Aplazame\Serializer\Decimal::fromFloat(21.00); // Article tax rate. (21.00%)
6262
$article->discount = Aplazame\Serializer\Decimal::fromFloat(5.00); // The discount amount of the article. (5.00 €)
6363

@@ -73,78 +73,75 @@ function createCheckoutPayload() {
7373
* Order model
7474
*/
7575
$order = new stdClass();
76-
$order->id = '28475648233786783165'; // Your order ID.
77-
$order->currency = 'EUR'; // Currency code of the order.
76+
$order->id = '28475648233786783165'; // Your order ID.
77+
$order->currency = 'EUR'; // Currency code of the order.
7878
$order->tax_rate = Aplazame\Serializer\Decimal::fromFloat(21.00); // Order tax rate. (21.00%)
7979
$order->total_amount = Aplazame\Serializer\Decimal::fromFloat(4620.00); // Order total amount. (4,620.00 €)
80-
$order->articles = $articles; // Articles in cart.
80+
$order->articles = $articles; // Articles in cart.
8181
$order->discount = Aplazame\Serializer\Decimal::fromFloat(160.00); // The discount amount of the order. (160.00 €)
8282
$order->cart_discount = Aplazame\Serializer\Decimal::fromFloat(0.50); // The discount amount of the cart. (0.50 €)
8383

8484
/*
8585
* Customer address model
8686
*/
8787
$customerAddress = new stdClass();
88-
$customerAddress->first_name = 'John'; // Address first name.
89-
$customerAddress->last_name = 'Coltrane'; // Address last name.
90-
$customerAddress->street = 'Plaza del Angel nº10'; // Address street.
91-
$customerAddress->city = 'Madrid'; // Address city.
92-
$customerAddress->state = 'Madrid'; // Address state.
93-
$customerAddress->country = 'ES'; // Address country code.
94-
$customerAddress->postcode = '28012'; // Address postcode.
95-
$customerAddress->phone = '616123456'; // Address phone number.
96-
$customerAddress->alt_phone = '+34917909930'; // Address alternative phone.
97-
$customerAddress->address_addition = 'Cerca de la plaza Santa Ana'; // Address addition.
88+
$customerAddress->first_name = 'John'; // Address first name.
89+
$customerAddress->last_name = 'Coltrane'; // Address last name.
90+
$customerAddress->street = 'Plaza del Valle Boreal nº10'; // Address street.
91+
$customerAddress->city = 'Madrid'; // Address city.
92+
$customerAddress->state = 'Madrid'; // Address state.
93+
$customerAddress->country = 'ES'; // Address country code.
94+
$customerAddress->postcode = '28080'; // Address postcode.
95+
$customerAddress->phone = '601234567'; // Address phone number.
96+
$customerAddress->address_addition = 'Cerca de la plaza Pontífice Sulyvahn'; // Address addition.
9897

9998
/*
10099
* Customer model
101100
*/
102101
$customer = new stdClass();
103-
$customer->id = '1618'; // Customer ID.
104-
$customer->email = 'dev@aplazame.com'; // The customer email.
105-
$customer->type = 'e'; // Customer type, the choices are g:guest, n:new, e:existing.
106-
$customer->gender = 0; // Customer gender, the choices are 0: not known, 1: male, 2:female, 3: not applicable.
107-
$customer->first_name = 'John'; // Customer first name.
108-
$customer->last_name = 'Coltrane'; // Customer last name.
102+
$customer->id = '1618'; // Customer ID.
103+
$customer->email = 'customer@address.com'; // The customer email.
104+
$customer->type = 'e'; // Customer type, the choices are g:guest, n:new, e:existing.
105+
$customer->gender = 0; // Customer gender, the choices are 0: not known, 1: male, 2:female, 3: not applicable.
106+
$customer->first_name = 'John'; // Customer first name.
107+
$customer->last_name = 'Coltrane'; // Customer last name.
109108
$customer->birthday = Aplazame\Serializer\Date::fromDateTime(new DateTime('1990-08-21 13:56:45')); // Customer birthday.
110-
$customer->language = 'es'; // Customer language preferences.
109+
$customer->language = 'es'; // Customer language preferences.
111110
$customer->date_joined = Aplazame\Serializer\Date::fromDateTime(new DateTime('2014-08-21 13:56:45')); // A datetime designating when the customer account was created.
112-
$customer->last_login = Aplazame\Serializer\Date::fromDateTime(new DateTime('2014-08-27 19:57:56')); // A datetime of the customer last login.
113-
$customer->address = $customerAddress; // Customer address.
111+
$customer->last_login = Aplazame\Serializer\Date::fromDateTime(new DateTime('2020-08-27 19:57:56')); // A datetime of the customer last login.
112+
$customer->address = $customerAddress; // Customer address.
114113

115114

116115
/*
117116
* Billing address model
118117
*/
119118
$billingAddress = new stdClass();
120-
$billingAddress->first_name = 'Bill'; // Billing first name.
121-
$billingAddress->last_name = 'Evans'; // Billing last name.
122-
$billingAddress->street = 'Calle de Las Huertas 22'; // Billing street.
123-
$billingAddress->city = 'Madrid'; // Billing city.
124-
$billingAddress->state = 'Madrid'; // Billing state.
125-
$billingAddress->country = 'ES'; // Billing country code.
126-
$billingAddress->postcode = '28014'; // Billing postcode.
127-
$billingAddress->phone = '+34914298407'; // Billing phone number.
128-
$billingAddress->alt_phone = null; // Billing alternative phone.
129-
$billingAddress->address_addition = 'Cerca de la pizzería'; // Billing address addition.
119+
$billingAddress->first_name = 'Bill'; // Billing first name.
120+
$billingAddress->last_name = 'Evans'; // Billing last name.
121+
$billingAddress->street = 'Calle Central Yharnam 92'; // Billing street.
122+
$billingAddress->city = 'Madrid'; // Billing city.
123+
$billingAddress->state = 'Madrid'; // Billing state.
124+
$billingAddress->country = 'ES'; // Billing country code.
125+
$billingAddress->postcode = '28080'; // Billing postcode.
126+
$billingAddress->phone = '601765432'; // Billing phone number.
127+
$billingAddress->address_addition = 'Cerca del Gran Puente'; // Billing address addition.
130128

131129

132130
/*
133131
* Shipping info model
134132
*/
135133
$shippingInfo = new stdClass();
136-
$shippingInfo->first_name = 'Django'; // Shipping first name.
137-
$shippingInfo->last_name = 'Reinhard'; // Shipping last name.
138-
$shippingInfo->street = 'Plaza del Angel nº10'; // Shipping street.
139-
$shippingInfo->city = 'Madrid'; // Shipping city.
140-
$shippingInfo->state = 'Madrid'; // Shipping state.
141-
$shippingInfo->country = 'ES'; // Shipping country code.
142-
$shippingInfo->postcode = '28012'; // Shipping postcode.
143-
$shippingInfo->name = 'Planet Express'; // Shipping name.
134+
$shippingInfo->first_name = 'Django'; // Shipping first name.
135+
$shippingInfo->last_name = 'Reinhard'; // Shipping last name.
136+
$shippingInfo->street = 'Plaza del Valle Boreal nº10'; // Shipping street.
137+
$shippingInfo->city = 'Madrid'; // Shipping city.
138+
$shippingInfo->state = 'Madrid'; // Shipping state.
139+
$shippingInfo->country = 'ES'; // Shipping country code.
140+
$shippingInfo->postcode = '28080'; // Shipping postcode.
141+
$shippingInfo->name = 'Planet Express'; // Shipping name.
144142
$shippingInfo->price = Aplazame\Serializer\Decimal::fromFloat(5.00); // Shipping price (tax is not included). (5.00 €)
145-
$shippingInfo->phone = '616123456'; // Shipping phone number.
146-
$shippingInfo->alt_phone = '+34917909930'; // Shipping alternative phone.
147-
$shippingInfo->address_addition = 'Cerca de la plaza Santa Ana'; // Shipping address addition.
143+
$shippingInfo->phone = '601234567'; // Shipping phone number.
144+
$shippingInfo->address_addition = 'Cerca de la plaza Pontífice Sulyvahn'; // Shipping address addition.
148145
$shippingInfo->tax_rate = Aplazame\Serializer\Decimal::fromFloat(21.00); // Shipping tax rate. (21.00%)
149146
$shippingInfo->discount = Aplazame\Serializer\Decimal::fromFloat(1.00); // The discount amount of the shipping. (1.00 €)
150147

0 commit comments

Comments
 (0)