Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function TfrmSignup.CreateSubscription: boolean;
- var
- auth: TAuthorizeNetARB;
- yy, mm, dd: word;
- begin
- CoInitialize(nil);
- Result := false;
- DecodeDate(Now, yy, mm, dd);
- auth := TAuthorizeNetARB.Create;
- try
- with auth do
- begin
- AUTHORIZE_LOGIN := _AUTHORIZE_LOGIN_live;
- AUTHORIZE_KEY := _AUTHORIZE_KEY_live;
- Merchant_assigned_name := IntToStr(FUserID);
- Amount := ReadValuesForAccoutType(cbAccountType.ItemIndex, 'AmountCharged');
- Trialamount := ReadValuesForAccoutType(cbAccountType.ItemIndex, 'TrialAmountCharged');
- Interval_length := StrToIntDef(ReadValuesForAccoutType(cbAccountType.ItemIndex, 'IntervalMonts'), 1); // months
- Startdate_month := mm;
- Startdate_day := dd;
- Startdate_year := yy;
- TotalOccurrences := StrToIntDef(ReadValuesForAccoutType(cbAccountType.ItemIndex, 'ContractMonths'), 9999);
- TrialOccurrences := StrToIntDef(ReadValuesForAccoutType(cbAccountType.ItemIndex, 'TrialOccurrences'), 0);
- CreditCard_cardNumber := ReplaceBadChars(eCardNumber.Text);
- CreditCard_expirationDate := ReplaceBadChars(eCardExpire.Text); // yyyy-mm
- CreditCard_cardCode := Trim(eCardCode.Text);
- CustomerID := IntToStr(FUserID);
- CustomerEmail := Trim(dbeEmail.Text);
- CustomerPhone := Trim(dbeCCode.Text) + Trim(dbeACode.Text) + Trim(dbePhone.Text);
- CustomerFax := Trim(dbeFax.Text);
- BillTo_firstName := Trim(dbeFname.Text);
- BillTo_lastName := Trim(dbeLname.Text);
- BillTo_address := Trim(dbeAddress1.Text) + ' ' + Trim(dbeAddress2.Text);
- BillTo_city := Trim(dbeCity.Text);
- BillTo_state := cbState.Items[cbState.ItemIndex];
- BillTo_zip := Trim(dbeZip.Text);
- BillTo_country := cbCountry.Items[cbCountry.ItemIndex];
- MakePayment;
- if ReturnCode = 0 then // success
- begin
- Result := true;
- FReturedSubscriptioID := ReturnSubscriptionID;
- FReturedText := ReturnMessage;
- end
- else
- begin
- Result := false;
- FReturedText := ReturnMessage;
- end;
- end;
- finally
- auth.Free;
- CoUninitialize;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement